<?php
/**
 * Created by PhpStorm.
 * User: 图图
 * Date: 2021-4-9
 * Time: 9:04
 */
namespace app\manage\validate;

use think\Validate;

/**
 * 行为验证器
 * @package app\menus\validate
 * @author
 */
class Point extends Validate
{
    //定义验证规则
    protected $rule = [
        'goods_name|商品名称'  => 'require',
        'market_price|划线价'  => 'require|float',
        'point|所需积分'  => 'require|float',
        'goods_price|商品价格'  => 'require|float',
        'goods_img|商品封面图'  => 'require',
        'goods_album|商品相册'  => 'require',
        'cat_id|所属分类'  => 'require',
        'sort|排序'=>'number|between:1,99'
    ];

    //定义验证提示
    protected $message = [
        'goods_name.require' => '请填写商品名称',
        'goods_price.require' => '请填写商品价格',
        'goods_price.number' => '商品价格必须为数字',
        'market_price.require' => '请填写商品划线价',
        'market_price.number' => '商品划线价必须为数字',
        'point.require' => '请填写商品所需积分',
        'point.number' => '商品所需积分必须为数字',
        'goods_img.require' => '请上传商品封面图',
        'goods_album.require' => '请上传商品相册',
        'cat_id.require' => '请选择商品分类',
        'sort.number'=>'排序数值请填写1-99之间'
    ];

}
